#ifndef _ARCHDATA_H
#define _ARCHDATA_H

struct VideoRecord {
  QString filename;
  QString archNum;
  double startTime;
  double endTime;
  double duration;
  double temperature;
  QString recipe;
  QString createTime;
  VideoRecord() { startTime = endTime = duration = temperature =0.0; } 
};

typedef struct _ArchRecord {
  QString num;
  QString sender;
  QString createTime;
}ArchRecord;

struct ImageRecord {
  QString filename;
  QString videoFile;
  QString createTime;
  double shotTime;
  ImageRecord () { shotTime = 0.0; }
};

void initArchData();

int getArchs(QStringList& sl);
int getArchs(QStringList &sl, QString num);
int getArchs(QStringList& sl,QString sortF, QString type, QString likeF, QString likeV);
int getVideos(QString num, QStringList& sl,QString sortF, QString type,  QString likeF, QString likeV);
int getImages(QString num, QStringList& sl,QString sortF, QString type,  QString likeF, QString likeV);

int getVideoRecord(QString filename, VideoRecord& videoRecord);
int addVideoRecord(VideoRecord& videoRecord);
int deleteVideoRecord(QString filename);

int getArchRecord(QString archNum, ArchRecord& archRecord);
int addArchRecord(ArchRecord& archRecord);
int deleteArchRecord(QString archNum);

int getImageRecord(QString filename, ImageRecord& imageRecord);
int addImageRecord(ImageRecord& imageRecord);
int deleteImageRecord(QString filename);

void modifyRecord(QString tableName, QString fieldName, QString fieldValue, QString keyName,QString keyValue);
void getTableField(QString table,QStringList& fl);
int getTableFieldValue(QString table, QString type, QString value, QStringList& fl, QStringList& vl);

int getVideoMark(QString filename, double& start, double& end);

#endif
